Skip to content

chore: upgrade preact#1389

Merged
colinaaa merged 1 commit intolynx-family:mainfrom
hzy:p/hzy/upgrade_preact
Jul 31, 2025
Merged

chore: upgrade preact#1389
colinaaa merged 1 commit intolynx-family:mainfrom
hzy:p/hzy/upgrade_preact

Conversation

@hzy
Copy link
Copy Markdown
Collaborator

@hzy hzy commented Jul 31, 2025

New hook _diff2 and renderComponent in options
To compare: preactjs/preact@10.24.0...hzy:preact:lynx/v10.24.x

Summary by CodeRabbit

  • Chores
    • Updated the version of a core dependency to ensure compatibility and stability.
  • New Features
    • Introduced new lifecycle hooks to improve component rendering and timing measurements.
    • Added a utility to enable method hooking for enhanced extensibility.
  • Refactor
    • Simplified internal component update logic to improve performance and maintainability.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

Copilot AI review requested due to automatic review settings July 31, 2025 09:59
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jul 31, 2025

⚠️ No Changeset found

Latest commit: 25745a1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 31, 2025

Warning

Rate limit exceeded

@hzy has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 47 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 2a576bf and 25745a1.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • packages/react/package.json (1 hunks)
  • packages/react/runtime/src/lynx/performance.ts (3 hunks)
  • packages/react/runtime/src/lynx/runWithForce.ts (1 hunks)
  • packages/react/runtime/src/renderToOpcodes/constants.ts (1 hunks)
  • packages/react/runtime/src/utils.ts (1 hunks)
  • packages/react/runtime/types/internal-preact.d.ts (1 hunks)
📝 Walkthrough

Walkthrough

The "preact" dependency version in the packages/react/package.json file was updated. New lifecycle hook constants were added, and the timing and force-run logic were refactored to use these hooks. A utility hook function was introduced to wrap existing methods, and a new optional method was added to the Options interface in the internal Preact types. No changes were made to exported or public entity signatures.

Changes

Cohort / File(s) Change Summary
Dependency Version Update
packages/react/package.json
Updated the "preact" dependency version in the dependencies section.
Lifecycle Hook Constants Addition
packages/react/runtime/src/renderToOpcodes/constants.ts
Added new constants DIFF2 and RENDER_COMPONENT for lifecycle hooks.
Performance Timing Refactor
packages/react/runtime/src/lynx/performance.ts
Refactored timing logic to use hooks RENDER_COMPONENT and ROOT instead of overriding options[DIFF].
Force Run Refactor
packages/react/runtime/src/lynx/runWithForce.ts
Simplified runWithForce to use the DIFF2 hook, removing WeakMap and vnode symbol tracking, directly accessing old vnode component.
Utility Function Addition
packages/react/runtime/src/utils.ts
Added hook utility function to wrap and hook into existing object methods.
Type Declaration Update
packages/react/runtime/types/internal-preact.d.ts
Added optional method __? to the Options interface in the Preact module declaration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Possibly related PRs

  • Revert "chore: upgrade preact" #1373: Related to preact dependency version updates and lifecycle hook refactoring, though this PR introduces new hooks and constants rather than reverting or changing hook signatures.

Suggested reviewers

  • colinaaa

Poem

🐇✨ Hooks and hops, the code refines,
Timing marks and forces align.
A version bumped, new constants play,
Wrapping methods in a clever way.
Types extended, smooth and bright,
The stack now dances, light as light!

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR upgrades the Preact dependency to a newer version that includes new hook _diff2 and renderComponent in options functionality. The upgrade moves from version 10.24.0-319c684e to 10.24.0-102a8e2d.

  • Updates Preact dependency to include new _diff2 hook and renderComponent options
  • Single dependency version bump in the React package
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

packages/react/package.json:177

  • The version '10.24.0-102a8e2d' appears to be a custom build with a commit hash. Verify that this version exists and is accessible in the @hongzhiyuan/preact registry, as this could cause installation failures if the version is not published or available.
    "preact": "npm:@hongzhiyuan/preact@10.24.0-102a8e2d"

@hzy hzy force-pushed the p/hzy/upgrade_preact branch from 5e87611 to cde950e Compare July 31, 2025 10:00
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jul 31, 2025

CodSpeed Performance Report

Merging #1389 will not alter performance

Comparing hzy:p/hzy/upgrade_preact (25745a1) with main (2831218)

Summary

✅ 10 untouched benchmarks

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Jul 31, 2025

React Example

#3513 Bundle Size — 235.13KiB (+0.02%).

25745a1(current) vs 2831218 main#3502(baseline)

Bundle metrics  Change 1 change
                 Current
#3513
     Baseline
#3502
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 38% 0%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 156 156
No change  Duplicate Modules 63 63
No change  Duplicate Code 45.94% 45.94%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#3513
     Baseline
#3502
No change  IMG 145.76KiB 145.76KiB
Regression  Other 89.37KiB (+0.05%) 89.33KiB

Bundle analysis reportBranch hzy:p/hzy/upgrade_preactProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Jul 31, 2025

Web Explorer

#3504 Bundle Size — 341.34KiB (0%).

25745a1(current) vs 2831218 main#3493(baseline)

Bundle metrics  Change 1 change
                 Current
#3504
     Baseline
#3493
No change  Initial JS 142.12KiB 142.12KiB
No change  Initial CSS 31.84KiB 31.84KiB
Change  Cache Invalidation 0% 26.83%
No change  Chunks 7 7
No change  Assets 7 7
Change  Modules 213(+0.47%) 212
No change  Duplicate Modules 17 17
No change  Duplicate Code 4% 4%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#3504
     Baseline
#3493
No change  JS 226.39KiB 226.39KiB
No change  Other 83.11KiB 83.11KiB
No change  CSS 31.84KiB 31.84KiB

Bundle analysis reportBranch hzy:p/hzy/upgrade_preactProject dashboard


Generated by RelativeCIDocumentationReport issue

@hzy hzy force-pushed the p/hzy/upgrade_preact branch 2 times, most recently from 6d63aae to 9b7e236 Compare July 31, 2025 12:12
@hzy hzy requested review from Yradex, colinaaa and upupming July 31, 2025 12:12
@hzy hzy force-pushed the p/hzy/upgrade_preact branch from 9b7e236 to 2a576bf Compare July 31, 2025 12:27
New hook `_diff2` and `renderComponent` in options
To compare: preactjs/preact@10.24.0...hzy:preact:lynx/v10.24.x
@hzy hzy force-pushed the p/hzy/upgrade_preact branch from 2a576bf to 25745a1 Compare July 31, 2025 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants